<template>
  <div class="father">
    <h2>孙组件</h2>
    <div>爷爷传来的值($attrs方法)：{{ value2 }}</div>
    <div>爷爷传来的值(inject接收)：{{ value3 }}</div>
    <button @click="getGrandSonData(value)">$attrs传值给爷爷</button>
  </div>
</template>

<script lang="ts" setup>
import { ref, defineProps, inject } from "vue";

defineProps(["value2", "getGrandSonData"]);
let value = ref("我是你孙子");
let value3 = inject("value3");
</script>

<style lang="less" scoped>
.father {
  height: 300px;
  padding: 20px;
  margin: 20px 0;
  font-size: 20px;
  background-color: pink;
  border-radius: 10px;
  box-shadow: 0 0 10px;
  .context {
    margin: 20px 0;
  }
}
</style>
